//
//  IntentionOrderView.m
//  mcosApp
//
//  Created by YaSha_Tom on 2018/12/12.
//  Copyright © 2018年 YaSha-Tom. All rights reserved.
//

#import "IntentionOrderView.h"
#import "IntentionListViewController.h"
#import "OrderViewController.h"
#import "UIImage+LX.h"

@interface IntentionOrderView ()<UITableViewDelegate,UITableViewDataSource>
@property (nonatomic,strong) UITableView *tableView;
@property (nonatomic,strong)UIImageView *image;
@property (nonatomic,copy) NSArray *titleArray;

@end

@implementation IntentionOrderView
- (UIImageView *)image {
    if (!_image) {
        _image = [[UIImageView alloc]init];
        _image.frame = CGRects(0, 0, 375, 200);
        _image.image = [UIImage imageNamed:@"welcomeMhome"];
    }
    return _image;
}
- (void)viewDidLoad {
    [super viewDidLoad];
    self.title = @"意向订单";
    self.titleArray  =@[@"意向信息",@"订单查看"];
    self.view.backgroundColor = [UIColor whiteColor];
    [self initUI];
    [self setupNavBar];
}
- (void)setupNavBar {
    [self.navigationController.navigationBar setTitleTextAttributes:@{NSFontAttributeName:[UIFont systemFontOfSize:18],NSForegroundColorAttributeName:[UIColor whiteColor]}];
    self.navigationController.navigationBar.translucent = NO;
    [self.navigationController.navigationBar setBackgroundImage:[UIImage getImageWithColor:[UIColor qmui_colorWithHexString:@"F55931"]] forBarMetrics:UIBarMetricsDefault];
    [self.navigationController.navigationBar setShadowImage:[[UIImage alloc] init]];
}
- (void)initUI{
    self.tableView = [[UITableView alloc]initWithFrame:CGRectMake(0, 0, kSCREEN_WIDTH, kSCREEN_HEIGHT) style:UITableViewStyleGrouped];
    self.tableView.delegate = self;
    self.tableView.dataSource = self;
    self.tableView.tableHeaderView = self.image;
    [self.view addSubview:self.tableView];
}
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
    return 1;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    return 2;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"cell"];
    if (cell == nil) {
        cell = [[UITableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"cell"];
    }
    cell.selectionStyle = UITableViewCellSelectionStyleNone;
    cell.textLabel.text = self.titleArray[indexPath.row];
    return cell;
}
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
    return 50*kHeightScale;
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
    if (indexPath.row == 0) {
        IntentionListViewController *intentionListViewController = [[IntentionListViewController alloc]init];
        intentionListViewController.hidesBottomBarWhenPushed = YES;
        [self.navigationController pushViewController:intentionListViewController animated:YES];
    }else {
        OrderViewController *orderViewController = [[OrderViewController alloc]init];
        orderViewController.hidesBottomBarWhenPushed = YES;
        [self.navigationController pushViewController:orderViewController animated:YES];
    }
    
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
